package com.hspedu.math_;

public class MathMethod {
    public static void main(String[] args) {
        //四舍五入
        long round = Math.round(-5.5);
        long round1 = Math.round(5.5);
        System.out.println(round);
        System.out.println(round1);

        //开方
        double sqrt = Math.sqrt(9.0);
        System.out.println(sqrt);

        //返回 [0, 1) 的随机数
        //返回 [2, 7] 的随机整数
        for (int i = 0; i < 10; i++) {
            System.out.println((int)(2 + Math.random() * 6));
        }
    }
}
